package com.snowflake.ecatalog.repository;

import java.util.Collection;
import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.snowflake.ecatalog.entity.Company;

/**
 * 企业
 */
public interface CompanyDao extends PagingAndSortingRepository<Company, Long>, JpaSpecificationExecutor<Company> {
	@Modifying
	@Query("update Company c set c.status = ?1 where c.id=?2")
	void changeStatus(Integer status, Long id);

	List<Company> findByCompanyCategorysIdAndStatus(Long categoryId, int status);

	List<Company> findByCompanyCategorysIdAndStatusAndIdNotIn(Long categoryId, int status, Collection<Long> exludeIdList);
}
